// 采集数据量统计
export function initEchartVolume(chartName,dataX,dataY) {
    var mychart = chartName;
    mychart.setOption(
        {
            color: ["#1890FF"],
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross',
                    label: {
                        backgroundColor: '#6a7985'
                    }
                }
            },
            toolbox: {
                feature: {
                    // saveAsImage: {}
                }
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true,
            },
            xAxis: [
                {
                    type: 'category',
                    boundaryGap: false,
                    data: dataX
                }
            ],
            yAxis: [
                {
                    type: 'value',
                    axisLine: {show:false},
                    splitLine :{    //网格线
                        lineStyle:{
                            type:'dashed'    //设置网格线类型 dotted：虚线   solid:实线
                        },
                        show:true //隐藏或显示
                    }
                }
            ],
            series: [
                {
                    name: '采集数量',
                    type: 'line',
                    stack: '总量',
                    areaStyle: {},
                    data: dataY
                },
            ]
        }
    );

}

// CPI
export function initEchartGPI(chartName,dataX,dataY) {
    var mychart = chartName;
    mychart.setOption(
        {
            color: ["#1890FF","#2FC25B"],
            title: {
                // text: '折线图堆叠'
            },
            tooltip: {
                trigger: 'axis'
            },
            // legend: {
            //     y: 'bottom'
            // },
            grid: {
                left: '6%',
                right: '6%',
                top: '8%',
                bottom: '12%',
                containLabel: true
            },
            toolbox: {
                feature: {
                    // saveAsImage: {}
                }
            },
            xAxis: {
                type: 'category',
                boundaryGap: false,
                data: dataX
            },
            dataZoom: [{
                type: 'inside',
                start: 90,
                end: 100
            }, {
                start: 90,
                end: 100,
                handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
                handleSize: '80%',
                handleStyle: {
                    color: '#fff',
                    shadowBlur: 3,
                    shadowColor: 'rgba(0, 0, 0, 0.6)',
                    shadowOffsetX: 2,
                    shadowOffsetY: 2
                }
            }],
            yAxis: {
                type: 'value',
                axisLine: {show:false},
                splitLine :{    //网格线
                    lineStyle:{
                        type:'dotted'    //设置网格线类型 dotted：虚线   solid:实线
                    },
                    show:true //隐藏或显示
                }
            },
            series: dataY
        }
    );
}

// PPI
export function initEchartPPI(chartName,dataX,dataY) {
    var mychart = chartName;
    mychart.setOption(
        {
            color: ["#5B8FF9"],
            title: {
                // text: 'PPI'
            },
            tooltip: {
                trigger: 'axis'
            },
            grid: {
                left: '6%',
                right: '6%',
                top: '8%',
                bottom: '12%',
                containLabel: true
            },
            toolbox: {
                feature: {
                    // saveAsImage: {}
                }
            },
            xAxis: {
                type: 'category',
                boundaryGap: false,
                data: dataX
            },
            dataZoom: [{
                type: 'inside',
                start: 90,
                end: 100
            }, {
                start: 90,
                end: 100,
                handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
                handleSize: '80%',
                handleStyle: {
                    color: '#fff',
                    shadowBlur: 3,
                    shadowColor: 'rgba(0, 0, 0, 0.6)',
                    shadowOffsetX: 2,
                    shadowOffsetY: 2
                }
            }],
            yAxis: {
                type: 'value',
                axisLine: {show:false},
                splitLine :{    //网格线
                    lineStyle:{
                        type:'solid'    //设置网格线类型 dotted：虚线   solid:实线
                    },
                    show:true //隐藏或显示
                }
            },
            series: [{
                data: dataY,
                type: 'line',
                areaStyle: {}
            }]
        }
    );
}

// 全国工资
export function initEchartCountryWage(chartName,dataX,dataY) {
    var mychart = chartName;
    mychart.setOption(
        {
            color: ["#5D7CC3"],
            title: {
                // text: '折线图堆叠'
            },
            tooltip: {
                trigger: 'axis'
            },
            grid: {
                left: '6%',
                right: '6%',
                top: '8%',
                bottom: '4%',
                containLabel: true
            },
            toolbox: {
                feature: {
                    // saveAsImage: {}
                }
            },
            xAxis: {
                type: 'category',
                data: dataX
            },
            yAxis: {
                type: 'value',
                axisLine: {show:false},
                splitLine :{    //网格线
                    lineStyle:{
                        type:'solid'    //设置网格线类型 dotted：虚线   solid:实线
                    },
                    show:true //隐藏或显示
                }
            },
            series: [{
                data: dataY,
                type: 'bar'
            }]
        }
    );
}

// 低保
export function initEchartSubsistence(chartName,dataX,dataCity,dataVillage) {
    var mychart = chartName;
    mychart.setOption(
        {
            color: ["#3C5899", "#30BF78"],
            tooltip: {
                trigger: 'axis'
            },
            legend: {
                y:'bottom'
            },
            grid: {
                left: '3%',
                right: '4%',
                top: '5%',
                bottom: '8%',
                containLabel: true
            },
            xAxis: {
                type: 'category',
                boundaryGap: false,
                data: dataX
            },
            yAxis: {
                type: 'value'
            },
            series: [
                {
                    name: '城市低保标准（元/人•月）',
                    type: 'line',
                    smooth: true,
                    stack: '总量',
                    data: dataCity
                },
                {
                    name: '农村低保标准（元/人•年）',
                    type: 'line',
                    smooth: true,
                    stack: '总量',
                    data: dataVillage
                },
        
            ]
        }
    );
}

// 数据类型 
export function initEchartOhter1(chartName,dataType) {
    var mychart = chartName;
    mychart.setOption(
        {
            color: ['#6395F9', '#62DAAB', '#657798', '#F6C022', '#E96C5B', '#74CBED', '#299999', '#BEE0E0'],
            tooltip: {
                trigger: 'item',
                formatter: '{a} <br/>{b} : {c} ({d}%)'
            },
            legend: {
                orient: 'vertical',
                left: 'left',
            },
            series: [
                {
                    name: '访问来源',
                    type: 'pie',
                    radius: '85%',
                    center: ['50%', '55%'],
                    data: dataType,
                    emphasis: {
                        itemStyle: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }
            ]
        }
    );
}

// 数据源 ,dataX,dataY
export function initEchartOhter2(chartName, dataSource) {
    var mychart = chartName;
    mychart.setOption(
        {
            color: ['#BEE0E0', '#BC9825 ', '#657798', '#F6C022', '#E96C5B', '#9996FF', '#28DCE1', '#4AC68A', '#6395F9', '#62DAAB', '#74CBED', '#299999', '#5B8FF9'],
            tooltip: {
                trigger: 'item',
                formatter: '{a} <br/>{b} : {c} ({d}%)'
            },
            legend: {
                orient: 'vertical',
                left: 'left',
            },
            series: [
                {
                    name: '数据源',
                    type: 'pie',
                    radius: '85%',
                    center: ['50%', '50%'],
                    data: dataSource,
                    // [
                    //     {value: 335, name: '京东'},
                    //     {value: 310, name: '淘宝'},
                    //     {value: 234, name: '阿里巴巴'},
                    //     {value: 135, name: '国家统计局'},
                    //     {value: 1548, name: 'NASA'}
                    // ],
                    emphasis: {
                        itemStyle: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }
            ]
        }
    );
}
